<template>
	<view @click="()=>(toDetail!==false?handleDetail():{})">
		<view class="goods_card vertical_card mt_5 br_4 flow_h width_160 publi-goods-items"
			v-if="type==='vertical-card'">
			<view class="pr">
				<view class="pa l_4 t_4 zi_1 fx aic plr_6 ptb_2 br_8"
					style="background: linear-gradient(135deg, #FF9347 0%, #FF7A4F 100%);" :style="saveTagStyle"
					v-if="showIcon&&typeTag">
					<image class="width_10 height_10 mr_2" :src="typeTag.src" mode=""></image>
					<text class="fz_10 fc_fff">{{typeTag.txt}}</text>
				</view>
				<view class="pr">
					<CusImage width="320rpx" height="320rpx" :src="data.coverImageUrl||data.imageUrl"
						mode="aspectFit" />
					<view class="pa fx l_4 t_4 fx_sh aic fz_10 p_1 br_2 zi_1" style="background: #FDE0B2;"
						v-if="goodsType==4">
						<text class="fc_primary">立省</text>
						<view class="lh_12 bc_fff fc_primary br_2 ml_4">
							{{savePrice}}元
						</view>
					</view>
				</view>

			</view>
			<view class="info_wrap box pt_8 pb_12 plr_8 ">
				<view class="fz_12 fc_333 fe lh_17 height_17">{{data.productName||''}}</view>
				<view>
					<view class="fz_14 fx jcb aic mt_8 public-re">
						<view class="fx fx_sh aib">
							<template v-if="token">
								<text class="fz_10 fc_r" v-if="realGoodsType==2">秒杀价：</text>
								<text class="fz_10 fc_r" v-else-if="realGoodsType==3">最低砍价：</text>
								<text class="fz_10 fc_r" v-else-if="realGoodsType==4">抢购价：</text>
								<text class="fz_10 fc_r" v-else-if="realGoodsType==5">拼团价：</text>
								<text class="fz_10 fc_r" v-else-if="appType==baseType">批发价：</text>
								<text class="fz_10 fc_r" v-else-if="appType!=baseType">会员价：</text>
							</template>
							<text class="fz_10 fc_r" v-else-if="appType!=baseType">会员价：</text>
							<text class="fz_10 fc_r">￥</text>
							<text class="fc_r fb fz_14">{{salePrice}}</text>
						</view>
						<image class="width_16 height_16 btn_wrap" src="../../static/images/goodsright.png" mode=""
							v-if="actGoods"></image>
						<image class="width_18 height_18 btn_wrap" src="../../static/images/home_cart.png" mode=""
							@click.stop="handleCart(data)" v-else></image>
					</view>
					<view class="public-re mt_4" style="height: 34rpx; line-height: 34rpx;">
						<view class="fx fx_sh fc_666 fz_10 aib" v-if="data.originalPrice && !noLogin">
							<text>零售价：</text>
							<text class="ml_2 flt">{{data.originalPrice}}</text>
						</view>
						<view class="point pa r_0 b_0 br_18 plr_4 pt_1 pb_1 fz_10 fc_fff lh_12" v-if="data.integra">
							可得{{data.integra}}积分
						</view>
						<!-- <image class="public-rightgoods" src="@/static/images/goodsright.png" mode="aspectFit"></image> -->
					</view>
				</view>
				<view class="tags_wrap fx fx_w grid_4" v-if="goodsType!=3&&goodsType!=4">
					<view class="lh_18 pl_6 pr_6 fz_12 mr_4 mt_4 br_2 bo_1 maxw_70 fe" v-for="item,index in tags"
						:key="index">
						{{item}}
					</view>
				</view>
				<slot name="bottom" />
			</view>
		</view>
		<!-- 首页爆品抢购 -->
		<view class="goods_card vertical_card mt_8 br_4 flow_h width_172 publi-goods-itemsc bc_fff"
			v-if="type==='rush-card'">
			<view class="pr">
				<CusImage width="344rpx" height="336rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />
			</view>
			<view class="info_wrap box pt_8 pb_12 plr_8 ">
				<view class="fz_12 fc_333 fe lh_17 height_17">{{data.productName||''}}</view>
				<view class="fx fx_w grid_4">
					<view class="fz_10 lh_14 br_2 plr_2" style="background-color: #FDE0B2;color: #F93914;">
						正品保障
					</view>
					<view class="fz_10 lh_14 br_2 plr_2" style="background-color: #FDE0B2;color: #F93914;">
						立省{{savePrice}}
					</view>
				</view>
				<view class="height_42 rush_bg pr pt_6 box pr">
					<view class="fz_10" style="color: #FE3B99;">
						销量 {{data.sales||0}}
					</view>
					<view class="mt_10 fx aib fz_10" style="color:#7D7D7D;">
						￥<text class="fz_14">{{data.originalPrice||0}}</text>
					</view>
					<view class="pa r_9 width_45 b_18 fc fz_10 fb fc_fff">
						￥<text class="fz_14">{{salePrice||0}}</text>
					</view>
				</view>
				<slot name="bottom" />
			</view>
		</view>
		<!-- 首页砍价 -->
		<view class="goods_card vertical_card mt_5 br_4 flow_h width_160 publi-goods-items"
			v-if="type==='vertical-card4'">
			<view class="pr">
				<view class="pa l_4 t_4 zi_1 fx aic plr_6 ptb_2 br_8" style="background: #D70000;" v-if="data.integra">
					<text class="fz_10 fc_fff">可得{{data.integra}}积分</text>
				</view>
				<CusImage width="304rpx" height="250rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />

			</view>
			<view class="info_wrap box pt_8 pb_12 plr_8 ">
				<view class="fz_10 fc_333 fe lh_17 height_17">{{data.productName||''}}</view>
				<view>
					<view class="fz_14 fx aic mt_4">
						<view class="fx fx_sh aic fz_10 p_1 br_2" style="background: #FDE0B2;">
							<text class="fc_primary">立省</text>
							<view class="lh_12 bc_fff fc_primary br_2 ml_4">
								{{savePrice}}元
							</view>
						</view>
						<view class="fz_10 ml_2">
							零售价：<text class="flt">{{data.originalPrice}}</text>
						</view>
					</view>
					<view class="fx aic jcb mt_4" style="height: 34rpx; line-height: 34rpx;">
						<view class="fx fx_sh fc_primary fz_10 aib" v-if="data.bargainirgMinPrice && !noLogin">
							<text class="fz_10">最低砍价：￥</text>
							<text class="fz_16 fb">{{data.bargainirgMinPrice}}</text>
						</view>
						<image class="width_18 height_18 btn_wrap" src="../../static/images/home_bargain.png" mode="">
						</image>
						<!-- <image class="public-rightgoods" src="@/static/images/goodsright.png" mode="aspectFit"></image> -->
					</view>
				</view>
				<view class="tags_wrap fx fx_w grid_4" v-if="goodsType!=3&&goodsType!=4">
					<view class="lh_18 pl_6 pr_6 fz_12 mr_4 mt_4 br_2 bo_1 maxw_70 fe" v-for="item,index in tags"
						:key="index">
						{{item}}
					</view>
				</view>
				<slot name="bottom" />
			</view>
		</view>
		<view class="goods_card vertical_card mt_5 br_4 flow_h width_106 publi-goods-items"
			v-if="type==='vertical-card3'">
			<view class="pr">
				<view class="pa l_4 t_4 zi_1 fx aic plr_6 ptb_2 br_8"
					style="background: linear-gradient(135deg, #FF9347 0%, #FF7A4F 100%);" v-if="showIcon&&typeTag">
					<image class="width_10 height_10 mr_2" :src="typeTag.src" mode=""></image>
					<text class="fz_10 fc_fff">{{typeTag.txt}}</text>
				</view>
				<CusImage width="212rpx" height="254rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />

			</view>
			<view class="info_wrap box pt_8 pb_12 plr_8 ">
				<!-- <view class="fz_12 fc_333 fe lh_17 height_17">{{data.productName||''}}</view>-->
				<view>
					<view class="fz_14 fx aib mt_8 public-re">
						<text class="fz_10 fc_r">￥</text>
						<text class="fc_r fb fz_14">{{salePrice}}</text>


					</view>


					<view class="plr_4" v-if="data.integra"
						style="background: #D70000; text-align: center; color: #fff; font-size: 24rpx; height: 38rpx; line-height: 38rpx; border-radius: 8rpx; margin: 0 auto;">
						可得{{data.integra}}积分
					</view>


					<!-- <view class="public-re" style="height: 34rpx; line-height: 34rpx;">
						<text class="ml_2 flt  fz_12 fc_666" v-if="data.originalPrice">¥{{data.originalPrice}}</text>
						<image class="public-rightgoods" src="@/static/images/goodsright.png" mode="aspectFit"></image>
					</view>  -->
				</view>
				<view class="tags_wrap fx fx_w grid_4" v-if="goodsType!=3&&goodsType!=4">
					<view class="lh_18 pl_6 pr_6 fz_12 mr_4 mt_4 br_2 bo_1 maxw_70 fe" v-for="item,index in tags"
						:key="index">
						{{item}}
					</view>
				</view>
				<slot name="bottom" />
			</view>
		</view>
		<view class="goods_card vertical_card mt_5 br_4 flow_h width_160 publi-goods-items"
			v-if="type==='vertical-card2'">
			<view class="pr">
				<CusImage width="320rpx" height="320rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />

			</view>
			<view class="info_wrap box pt_8 pb_12 plr_8">
				<view class="fz_12 fc_333 fe_2 lh_18 height_36">{{data.productName||''}}</view>
				<view>
					<view class="fz_14 fx aib mt_8 public-re">
						<text class="fz_10 fc_r">￥</text>
						<text class="fc_r fb fz_14">{{salePrice}}</text>
						<view class="point pa r_0 b_0 br_18 pr_7 pl_7 pt_1 pb_1 fz_10 fc_fff lh_12" v-if="data.integra">
							可得{{data.integra}}积分
						</view>
					</view>
					<view class="public-re" style="height: 34rpx; line-height: 34rpx;">
						<text class="ml_2 flt  fz_12 fc_666"
							v-if="data.originalPrice && !noLogin">¥{{data.originalPrice}}</text>
						<image class="width_18 height_18 btn_wrap pa t_0 r_0" src="@/static/images/home_cart.png"
							mode="aspectFit" @click.stop="handleCart(data)"></image>
					</view>

				</view>
				<slot name="bottom" />
			</view>
		</view>
		<view class="goods_card card fx fx_nw" v-if="type==='card'">
			<view class="br_4 flow_h fx_sh">
				<CusImage width="160rpx" height="160rpx" :src="data.productImageUrl||data.coverImageUrl||data.imageUrl"
					mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_14 fe">{{data.productName||''}}</view>
				<view class="fz_12 fc_999 mt_4">{{specification}}</view>
				<view class="fz_12 fc_999 mt_4">x{{data.payNum||0}}</view>
				<!-- <view class="fx fx_w mt_4">
					<view class="lh_14 fz_12 mr_8" v-for="item,index in extra" :key="index">
						<text class="fc_999">{{item.name}}</text>
						<text>￥{{item.value}}</text>
					</view>
				</view> -->
				<view class="fz_16 fb mt_4">
					¥{{data.transactionPrice||0}}
				</view>
			</view>
		</view>
		<!-- 评价商品 -->
		<view class="goods_card card fx fx_nw" v-if="type==='evaluate-card'">
			<view class="br_4 flow_h fx_sh">
				<CusImage width="182rpx" height="182rpx"
					:src="data.productImage||data.coverImageUrl||data.imageUrl||data.image" mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_14 fe_2 lh_20 height_40 fb">{{data.productName||''}}</view>
				<view class="fz_12 fc_999 mt_4">{{productRuleStr(data.productRule||data.attrValue)}}
					x{{data.productCount||data.payNum||0}}</view>
				<view class="fb mt_1 fc_zhured">
					¥<text class="fz_20">{{salePrice||0}}</text>
				</view>
			</view>
		</view>
		<!-- 评价详情商品 -->
		<view class="goods_card card fx fx_nw" v-if="type==='evaluate-detail-card'">
			<view class="br_4 flow_h fx_sh">
				<CusImage width="182rpx" height="182rpx" :src="data.productImage||data.imageUrl||data.image"
					mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h pr_25">
				<view class="fz_14 fe_2 lh_20 height_40 fb">{{data.productName||''}}</view>
				<view class="fz_12 fc_999 mt_4">{{productRuleStr(data.productRule||data.attrValue)}}
					x{{data.productCount||0}}
				</view>
			</view>
		</view>
		<!-- 商品售后 -->
		<view class="goods_card card fx fx_nw" v-if="type==='aftersale-card'">
			<view class="br_4 flow_h fx_sh">
				<CusImage width="182rpx" height="182rpx"
					:src="data.productImageUrl||data.coverImageUrl||data.imageUrl||data.image" mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_14 fe_2 lh_20 height_40 fb">{{data.productName||''}}</view>
				<view class="fz_12 height_14 fc_999 mt_8">{{productRuleStr(data.productRule)}} x{{data.payNum||0}}
				</view>
				<!-- <view class="mt_22 fc_zhured">
					¥<text class="fz_16">{{data.transactionPrice||0}}</text>
				</view> -->
			</view>
		</view>
		<view class="goods_card card fx fx_nw" v-if="type==='info-card'">
			<view class="br_4 flow_h fx_sh">
				<CusImage width="160rpx" height="160rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_14 fe">{{data.productName||data.name||''}}</view>
				<view class="fz_12 fc_999 mt_4">{{specification}} x{{data.payNum}}</view>
				<view class="fx fx_w mt_4" v-if="extra.length">
					<view class="lh_14 fz_12 mr_8" v-for="item,index in extra" :key="index">
						<text class="fc_999">{{item.name}}</text>
						<text>￥{{item.value}}</text>
					</view>
				</view>
				<view class="fz_16 mt_4 fc_zhured" :style="extra.length?'':goodsType==6?'margin-top: 8rpx':'margin-top: 44rpx;'">
					<view class="fc_zhured fb" v-if="goodsType==6">
						<text class="fz_14">{{data.integral||0}}积分</text>
						<text class="fz_10">+ ¥</text>
						<text class="fz_14">{{data.actualPrice||0}}</text>
					</view>
					<view v-if="goodsType==6">
						<text class="mt_2 fc_999 fz_12 flt"
							v-if="!noLogin">¥{{data.originalPrice||0}}</text>
					</view>
					<view v-else>
						<text class="fb fc_zhured">¥{{payAmount}}</text>
						<text class="ml_8 fc_999 fz_12 flt"
							v-if="goodsType!=6 && !noLogin">¥{{data.originalPrice||0}}</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 拼团商品列表 -->
		<view class="goods_card group_card fx fx_nw" v-if="type==='group-card'">
			<view class="fx_sh pr">
				<view class="pa fx l_10 t_10 fx_sh aic fz_10 p_1 br_2 zi_1" style="background: #FDE0B2;">
					<text class="fc_primary">立省</text>
					<view class="lh_12 bc_fff fc_primary br_2 ml_4">
						{{savePrice}}元
					</view>
				</view>
				<CusImage width="240rpx" height="240rpx" radius="24rpx" :src="data.coverImageUrl||data.imageUrl"
					mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_16 fe fb">{{data.productName||''}}</view>
				<view class="tags_wrap fx fx_w minh_18 mt_4">
					<view class="lh_18 pl_6 pr_6 fz_12 mr_4 mt_4 br_2 bo_1 maxw_70 fe" v-for="item,index in tags"
						:key="index">
						{{item}}
					</view>
				</view>
				<view class="mt_12 fc_r fx aic">
					<text class="fb">¥<text
							class="fz_20">{{noLogin?data.originalPrice:(data.activityPrice||data.groupPrice||0)}}</text></text>
					<!-- <view class="point_inner ml_4 pr_4 plr_7 ptb_1 fz_10 lh_12" v-if="data.integra">
						可得积分: {{data.integra}}
					</view> -->
					<view class="point pa r_0 b_0 br_18 plr_4 pt_1 pb_1 fz_10 fc_fff lh_12" v-if="data.integra">
						可得{{data.integra}}积分
					</view>

				</view>
				<view class="pr mt_4 pl_13 box group_btn br_8 fx aic w100 height_32 fz_12">
					<view class="fc_r">
						{{data.openGroup||0}}人团
					</view>
					<view class="ml_4 group_price flt" v-if="!noLogin">
						¥{{data.originalPrice||0}}
					</view>
					<view class="group_btn_right pa t_0 b_0 r_0 width_78 fx aic jcc fc_fff">
						去拼团
					</view>
				</view>
			</view>
		</view>
		<view class="goods_card seckill_card fx fx_nw" v-if="type==='seckill-card'">
			<view class="fx_sh pr">
				<view class="pa fx l_10 t_10 fx_sh aic fz_10 p_1 br_2 zi_1" style="background: #FDE0B2;">
					<text class="fc_primary">立省</text>
					<view class="lh_12 bc_fff fc_primary br_2 ml_4">
						{{savePrice}}元
					</view>
				</view>
				<CusImage width="240rpx" height="240rpx" radius="24rpx" :src="data.coverImageUrl||data.imageUrl"
					mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_14 fe fb">{{data.productName||''}}</view>
				<view class="tags_wrap fx fx_w height_19 mt_4">
					<view class="lh_18 pl_6 pr_6 fz_12 mr_4 mt_4 br_2 bo_1 maxw_70 fe" v-for="item,index in tags"
						:key="index">
						{{item}}
					</view>
				</view>
				<view class="mt_12 fc_r fx aic">
					<text class="fz_16 fb">¥<text class="fz_20">{{data.seckillPrice||0}}</text></text>
					<!-- <view class="point_inner ml_4 pr_4 plr_7 ptb_1 fz_10 lh_12" v-if="data.integra">
						可得积分: {{data.integra}}
					</view> -->

					<view class="point pa r_0 b_0 br_18 plr_4 pt_1 pb_1 fz_10 fc_fff lh_12" v-if="data.integra">
						可得{{data.integra}}积分
					</view>

				</view>
				<!-- 秒杀中 -->
				<view class="pr mt_4 pl_13 box group_btn br_8 fx aic w100 height_32 fz_12"
					v-if="parentData.activitiesStatus==1">
					<view class="progress fx aic">
						<view class="width_81">
							<u-line-progress :percentage="data.seckillSchedule" activeColor="#ff0000"
								inactiveColor="#FFD7C8" :showText="false"></u-line-progress>
						</view>
						<text class="ml_2">已抢{{data.seckillSchedule}}%</text>
					</view>
					<view class="group_btn_right pa t_0 b_0 r_0 width_59 fx aic jcc fc_fff">
						秒杀中
					</view>
				</view>
				<!-- 待开始 -->
				<view class="pr mt_4 pl_13 box group_btn undo br_8 fx aic w100 height_32 fz_12" v-else>
					<view class="group_price flt" v-if="!noLogin">
						¥{{data.originalPrice||0}}
					</view>
					<view class="group_btn_right pa t_0 b_0 r_0 width_59 fx aic jcc fc_fff">
						待开始
					</view>
				</view>
			</view>
		</view>
		<!-- 砍价-我的砍价 -->
		<view class="goods_card bargain_card fx fx_nw" v-if="type==='bargain-card'" key="bargain_card"
			@click.stop="()=>(toDetail!==false?handleDetail('bargain'):{})">
			<view class="fx_sh pr">
				<view class="pa fx l_10 t_10 fx_sh aic fz_10 p_1 br_2 zi_1" style="background: #FDE0B2;">
					<text class="fc_primary">立省</text>
					<view class="lh_12 bc_fff fc_primary br_2 ml_4">
						{{savePrice}}元
					</view>
				</view>
				<CusImage width="240rpx" height="240rpx" radius="24rpx"
					:src="data.coverImageUrl||data.specificationImageUrl" mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_16 fb">
					已砍{{data.bargainirgPrice||0}}元<text v-if="bargainInfo.gap">，仅差<text
							class="fc_primary">{{bargainInfo.gap}}元</text></text>
				</view>
				<view class="mt_9 group_btn">
					<view class="progress w100">
						<u-line-progress :percentage="bargainInfo.percent"
							activeColor="linear-gradient(90deg, #FA4904 0%, #FF9000 100%)" inactiveColor="#FFD7C8"
							:showText="false"></u-line-progress>
					</view>
					<view class="countdown fx_1 fx aic pt_20" v-if="data.bargainirgStatus==0">
						<CountDown :time="new Date(data.endTime).getTime()-new Date().getTime()" color="#8F5705"
							@finish="$emit('finish')" />
						<view class="ml_2 fz_12">
							后结束
						</view>
					</view>
					<view class="mt_10">
						<button class="custom_btn lh_32 primary w100 mt_12 br_20 fz_14"
							@click.stop="handleDetail('bargain')">
							继续邀请砍价
						</button>
					</view>
				</view>
			</view>
		</view>
		<!-- 砍价商品 -->
		<view class="goods_card card fx fx_nw" v-if="type==='bargain-list-card'">
			<view class="fx_sh pr">
				<CusImage width="240rpx" height="240rpx" radius="24rpx"
					:src="data.coverImageUrl||data.specificationImageUrl" mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_16 fb fe">{{data.name||data.productName||''}}</view>
				<view class="mt_11 fx">
					<view class="br_50 plr_3 pt_1 pb_1 fz_10 fc_fff lh_12 mr_8" style="background: #D70000;" v-if="data.integra">
						可得{{data.integra}}积分
					</view>
					<view class="fx fx_sh aic fz_10 p_1 br_2 zi_1" style="background: #FDE0B2;">
						<text class="fc_primary">立省</text>
						<view class="lh_12 bc_fff fc_primary br_2 ml_4">
							{{savePrice}}元
						</view>
					</view>
				</view>
				<view class="fx aib mt_4">
					<view class="fb fc_r fx aib">
						最低¥<text class="fz_20">{{data.bargainirgMinPrice||0}}</text>
					</view>
					<view class="fz_12 flt fc_999 ml_8">
						￥{{data.originalPrice||0}}
					</view>
				</view>
				<view class="mt_10">
					<button style="background: linear-gradient(90deg, #FA4704 0%, #FE8D00 100%);"
						class="goods_card custom_btn lh_32 primary w100 mt_12 br_20 fz_14">
						发起砍价
					</button>
				</view>
			</view>
		</view>
		<!-- 砍价商品详情 -->
		<view class="goods_card bargain_card fx fx_nw" v-if="type==='bargain-info-card'" key="bargain_card">
			<view class="fx_sh">
				<CusImage width="240rpx" height="240rpx" radius="24rpx"
					:src="data.coverImageUrl||data.specificationImageUrl" mode="aspectFit" />
			</view>
			<view class="ml_12 fx_1 flow_h">
				<view class="fz_16 fb fe">
					{{data.name||''}}
				</view>
				<view class="mt_4 fz_12">
					最低价￥{{data.bargainirgMinPrice||''}}
				</view>
				<view class="mt_4 fz_12">
					剩余：{{data.stock||0}}件
				</view>
				<view class="mt_6 group_btn" v-if="data.bargainirgStatus==0">
					<view class="countdown fx_1 fx aic">
						<CountDown :time="new Date(data.endTime).getTime()-new Date().getTime()" color="#8F5705"
							@finish="$emit('finish')" />
						<view class="ml_2 fz_12">
							后结束
						</view>
					</view>
				</view>
				<view class="fb mt_4 fc_r fx aib">
					当前价<text
						class="fz_20">¥{{$utils.floatSub((data.bargainirgStartPrice||0),(data.bargainirgPrice||0))}}</text>
				</view>
				<view class="mt_4 fz_14 fc_primary" v-if="data.bargainirgStatus==2">
					{{$u.timeFormat(data.orderTime||data.endTime, 'yyyy/mm/dd hh:MM')}}活动已结束
				</view>
			</view>
			<u-icon name="arrow-right" size="24"></u-icon>
		</view>
		<view class="goods_card simple_card width_148 br_8 flow_h" v-if="type==='simple_card'" key="bargain_card">
			<CusImage width="296rpx" height="296rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />
			<view class="p_8 flow_h bo_1 boc_grey bot_0" style="border-radius: 0 0 16rpx 16rpx;">
				<view class="fz_12 fe_2 lh_18 height_36">
					{{data.productName||''}}
				</view>
				<view class="mt_4 fx aib">
					<view class="fc_primary fb">
						<text class="fz_10">￥</text>
						<text class="fz_14">{{salePrice}}</text>
					</view>
					<view class="fz_10 flt" style="color:#bbb" v-if="!noLogin">
						¥{{data.originalPrice||0}}
					</view>
				</view>
			</view>
		</view>
		<view class="goods_card simple_card width_168 mt_5 br_8 flow_h bc_fff" v-if="type==='integral_card'"
			key="integral_card">
			<CusImage width="336rpx" height="216rpx" :src="data.coverImageUrl||data.imageUrl" mode="aspectFit" />
			<view class="p_8 flow_h bo_1 boc_grey bot_0" style="border-radius: 0 0 16rpx 16rpx;">
				<view class="fz_12 fe lh_18 height_18">
					{{data.productName||''}}
				</view>
				<view class="mt_8 fx">
					<view class="fc_zhured fb">
						<text class="fz_12">{{data.integra||0}}积分</text>
						<text class="fz_10">+ ¥</text>
						<text class="fz_12">{{data.salePrice||0}}</text>
					</view>
				</view>
				<view class="mt_8 fc_999 fz_12 flt">
					￥{{data.originalPrice||0}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import CusImage from '@/components/Image'
	import CountDown from '@/components/CountDown'
	import {
		mapState,
		mapGetters
	} from 'vuex'
	import api from '@/service/config/api.js'
	export default {
		components: {
			CusImage,
			CountDown
		},
		props: {
			type: {
				type: String,
				default: 'vertical-card'
			},
			data: {
				type: Object,
				default: () => ({})
			},
			parentData: {
				type: Object,
				default: null
			},
			score: {
				type: String | Number,
				default: 20
			},
			extra: {
				type: Array,
				default: () => ([])
			},
			// 商品类型 1-普通，2-秒杀，3-砍价，4-抢购，5-拼团，6-积分 7-评价商品
			goodsType: {
				type: String | Number,
				default: 1
			},
			toDetail: {
				type: undefined | Boolean,
				default: true
			},
			showIcon: {
				type: undefined | Boolean,
				default: false
			},
			integralType: {
				type: String | Number,
				default: 0
			}
		},
		computed: {
			...mapState(['appType', 'token']),
			...mapGetters(['noLogin']),
			baseType() {
				return this.$base.ADMIN_TYPE
			},
			specification() {
				if (this.data && (this.data.productAttr || this.data.productRule || this.data.attrValue)) {
					let attrData = (/^\[\S+\]$/).test(this.data.productAttr || this.data.productRule || this.data
						.attrValue) ? JSON.parse(this
						.data
						.productAttr || this.data.productRule || this.data.attrValue) : (this.data.productAttr || this
						.data.productRule || this.data.attrValue)
					if (attrData instanceof Array) {
						return attrData.map(item => item.value).join(' ')
					} else {
						return attrData
					}
				}
				return this.data.productRuleName || ''
			},
			productRuleStr() {
				return data => {
					return data ? JSON.parse(data).map(item1 => item1.value).join(' ') : ''
				}
			},
			// 积分价格
			integralPrice() {
				return (data) => {
					if (data && data.salePrice) {
						if (this.noLogin) {
							return {
								integral: Math.round(this.$utils.floatMul(data.originalPrice || 0, this.$utils
									.floatMul(0.01, data
										.integralPayRatio || 0))),
								price: Math.round(this.$utils.floatMul(data.originalPrice || 0, this.$utils.floatMul(
									0.01, (100 -
										data.integralPayRatio || 0))))
							}
						}
						return {
							integral: Math.round(this.$utils.floatMul(data.salePrice || 0, this.$utils.floatMul(0.01,
								data
								.integralPayRatio || 0))),
							price: Math.round(this.$utils.floatMul(data.salePrice || 0, this.$utils.floatMul(0.01, (
								100 -
								data.integralPayRatio || 0))))
						}
					}
					return {
						integral: 0,
						price: 0
					}
				}
			},
			// 进度
			percentage() {
				return Math.floor((this.data.sales || 0 / this.data.stock || 0) * 100)
			},
			bargainInfo() {
				return ({
					percent: Math.floor(((this.data.bargainirgPrice || 0) / ((this.data
						.bargainirgStartPrice || 0) - (this.data.bargainirgMinPrice || 0))) * 100),
					gap: this.$utils.floatSub(this.$utils.floatSub((this.data.bargainirgStartPrice || 0), (this
						.data
						.bargainirgPrice || 0)), (this.data
						.bargainirgMinPrice || 0))
				})
			},
			typeTag() {
				switch (this.$utils.goodsTypeDir(this.data.goodsType)) {
					case 2:
						return {
							src: require('@/static/images/goods_icon_ms.png'),
								txt: '秒杀'
						}
					case 3:
						return {
							src: require('@/static/images/goods_icon_kj.png'),
								txt: '砍价'
						}
					case 4:
						return {
							src: require('@/static/images/goods_icon_qg.png'),
								txt: '抢购'
						}
					case 5:
						return {
							src: require('@/static/images/goods_icon_pt.png'),
								txt: '拼团'
						}
					default:
						return false
				}
			},
			tags() {
				const arr = []
				if (this.data.brandName) {
					arr.push(this.data.brandName)
				}
				if (this.data.styleName) {
					arr.push(this.data.styleName)
				}
				return arr
			},
			salePrice() {
				if (this.noLogin) {
					return this.data.originalPrice || 0
				}
				if (this.goodsType == 7) {
					if (this.data.transactionPrice != undefined) {
						return this.data.transactionPrice || 0
					}
					return this.$store.state.appType === this.$base.USER_TYPE ? (this.data.price || 0) : (this.data
						.purchasingPrice ||
						this.data.price || 0)
				}
				const goodsType = (this.data.goodsType == null || this.data.goodsType == undefined) ? this.goodsType : this
					.$utils.goodsTypeDir(this.data.goodsType)
console.log("goodsType=",goodsType)
				const price = this.$store.state.appType === this.$base.USER_TYPE ? (this.data.salePrice || 0) : (this.data
					.wholesalePrice ||
					this.data.salePrice || 0)
				if (goodsType == 2) {
					return this.data.seckillPrice || price || 0
				}
				if (goodsType == 3) {
					return this.data.bargainirgMinPrice || price || 0
				}
				if (goodsType == 5) {
					return this.data.groupPrice || price || 0
				}
				return price || 0
			},
			realGoodsType() {
				return (this.data.goodsType == null || this.data.goodsType == undefined) ? this.goodsType : this
					.$utils.goodsTypeDir(this.data.goodsType)
			},
			actGoods() {
				return this.realGoodsType > 1 && this.realGoodsType < 6
			},
			payAmount() {
				// if (this.goodsType == 2) {
				// 	return this.data.seckillPrice || 0
				// }
				// if (this.goodsType == 5) {
				// 	return this.data.groupPrice || 0
				// }
				return this.data.actualPrice || 0
			},
			savePrice() {
				return this.$utils.floatSub(this.data.originalPrice || 0, this.salePrice)
			},
			saveTagStyle() {
				return this.goodsType == 4 ? 'left:auto;right:8rpx;' : ''
			}
		},
		data() {
			return {
				timeData: {},
			}
		},
		mounted() {
		},
		methods: {
			onChangeCountdown(e) {
				this.timeData = e
			},
			handleDetail(type) {
				if (this.noLogin) {
					return this.$utils.modalRedirectToLogin()
				}
				switch (type) {
					case 'bargain':
						uni.navigateTo({
							url: '/pages/goods/pages/bargain_info?id=' + this.data.id
						})
						break
					default:
						const goodsType = Number((this.data.goodsType == null || this.data.goodsType == undefined) ? this
							.goodsType : this.$utils.goodsTypeDir(this.data.goodsType))
						const goodsId = (goodsType > 1 && goodsType < 6) ? (this.data.activityId || this.data.id) : this
							.data.id
						uni.navigateTo({
							url: `/pages/goods/pages/detail?id=${goodsId}&goodsType=${goodsType}` +
								(this
									.integralType ? `&integralType=${this.integralType}` : '')
						})
						break
				}

			},
			handleCart(data) {
				this.$utils.loading()
				api.post('/goods/api/ShoppingCart/addShoppingCart', {
					productNum: 1,
					productId: data.id
				}).then(res => {
					this.$utils.showToast('已加入购物车')
				})
			}
		},
	}
</script>

<style lang="scss">
	.goods_card {
		&.vertical_card {

			.info_wrap {
				border-radius: 0 0 8rpx 8rpx;
				border-color: #E4E4E4;
			}

			.point {
				background: #D70000;
				line-height: 24rpx;
				border-bottom-left-radius: 0;
				border-top-left-radius: 36rpx;

				&::after {
					content: '';
					width: 0;
					height: 0;
					border: 5rpx solid;
					border-color: transparent #D70000 #D70000 transparent;

					position: absolute;
					left: -8rpx;
					bottom: 0;
				}
			}

			.tags_wrap>view {
				border-color: #ccc;
			}
		}

		&.group_card,
		&.seckill_card {

			.point_inner {
				background: #FFF6F4;
			}

			.group_btn {
				background: #FFF6F4;

				.group_price {
					color: #F99B99;
				}

				.group_btn_right {
					background: url('~@/static/images/btn1.png');
					background-size: 100% 100%;
				}
			}
		}

		&.seckill_card {
			.group_btn_right {
				background-image: url('~@/static/images/btn2.png') !important;
			}

			.progress {
				color: #FE0000;

			}

			/deep/.u-line-progress__background {
				width: 162rpx;
				background-color: #FFC3C3;
			}

			.undo {
				background: #EAF8EC !important;

				.group_price {
					color: #00BE73;
				}

				.group_btn_right {
					background-image: url('~@/static/images/btn3.png') !important;
				}
			}
		}

		&.bargain_card {
			.countdown {
				color: #8F5705;
			}
		}

		.rush_bg {
			background: url('../../static/images/rush_bg.png');
			background-size: 100% 100%;
		}
	}
</style>